package com.campus.controller;

import com.campus.mapper.ClassMapper;
import com.campus.service.IClassService;
import com.campus.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/class")
public class ClassController {

    @Autowired
    private IClassService iClassService;

    @PostMapping("/create")
    public R create(Integer id,
                    String name,
                    String classDesc,
                    Integer teacherId,
                    Integer activityId)
    {
        return R.success(iClassService.createClass(id, name, classDesc, teacherId, activityId));
    }

    @PutMapping("/update")
    public R update(Integer id,String name,String classDesc,Integer teacherId,Integer activityId)
    {
        return R.success(iClassService.updateClass(id, name, classDesc, teacherId, activityId));
    }

    @PostMapping("/createStudent")
    public R createStudent(Integer id,String stuName,String fromPlace,String parentPhone,String currentGrade,Integer loginId,Integer classId)
    {
        return R.success(iClassService.createStudent(id, stuName, fromPlace, parentPhone, currentGrade, loginId, classId));
    }
}
